package com.esiag.isidis.fi.pdsteam.views;

import java.awt.HeadlessException;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.esiag.isidis.fi.pdsteam.content.EventFinder;
import com.esiag.isidis.fi.pdsteam.content.EventFinderFromDB;
import com.esiag.isidis.fi.pdsteam.content.EventInfoFinderfromUI;

public class Frame_Scenario extends JFrame  {
	private JPanel content;
	private JPanel linesContainer;
	private Header header;
	private JButton generate;
	private EventFinder finder;
	public JPanel getContent() {
		return content;
	}
	public void setContent(JPanel content) {
		this.content = content;
	}
	public JPanel getLinesContainer() {
		return linesContainer;
	}
	public void setLinesContainer(JPanel linesContainer) {
		this.linesContainer = linesContainer;
	}
	public Frame_Scenario() throws HeadlessException {

		super();
		content=(JPanel)getContentPane();
		linesContainer=new JPanel();
		linesContainer.setLayout(new BoxLayout(linesContainer, BoxLayout.Y_AXIS));
		JPanel p=new JPanel();
		p.add(linesContainer);
		header =new Header(this);
		content.add("North",header);
		content.add("Center",p);
		generate=new JButton("Generate");
		//TODO instanciate Finder
		finder = new EventFinderFromDB();
		EventInfoFinderfromUI eif=new EventInfoFinderfromUI(this, finder);
		generate.addActionListener(eif);
		content.add("South",generate);

		setSize(800, 600);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
	}
	public static void main(String[] args) {
		new Frame_Scenario();
	}

}
